feat: add sdk-core vault module interfaces and scaffolding#9198
Conversation
009db3a to
14e320a
Compare
| bitgoNitroChallenge: SerializedNtildeWithVerifiers | ||
| ): Promise<void>; | ||
| hasFeatureFlags(flags: EnterpriseFeatureFlag[]): boolean; | ||
| vaults(): IVaults; |
There was a problem hiding this comment.
Lets add an @experimental jsdoc, in case we need to make breaking changes before the public release.
| // whole-vault: view/admin/spend; spend opens a key share (also how a spender services a | ||
| // vaultShareRequests entry in UMS orgs) | ||
| addMember(params: AddVaultMemberOptions): Promise<VaultData>; | ||
| // share ONE vault wallet (FR-13), not the whole vault |
There was a problem hiding this comment.
| // share ONE vault wallet (FR-13), not the whole vault | |
| // share ONE vault wallet, not the whole vault |
|
|
||
| export interface IVaults { | ||
| // orchestrates: initialize → 4 root key flows (vaultId-tagged) → finalize → keycard | ||
| createVault(params: CreateVaultOptions): Promise<Vault>; |
There was a problem hiding this comment.
| createVault(params: CreateVaultOptions): Promise<Vault>; | |
| createVaultKeys(params: CreateVaultOptions): Promise<Vault>; |
| createVault(params: CreateVaultOptions): Promise<Vault>; | ||
| initializeVault(params: InitializeVaultOptions): Promise<Vault>; | ||
| finalizeVault(vaultId: string, params: FinalizeVaultOptions): Promise<Vault>; |
There was a problem hiding this comment.
| createVault(params: CreateVaultOptions): Promise<Vault>; | |
| initializeVault(params: InitializeVaultOptions): Promise<Vault>; | |
| finalizeVault(vaultId: string, params: FinalizeVaultOptions): Promise<Vault>; | |
| initializeVault(params: InitializeVaultOptions): Promise<Vault>; | |
| createVaultKeys(params: CreateVaultOptions & VaultCreationPhase1): Promise<VaultKeys>; | |
| finalizeVault(vaultId: string, params: FinalizeVaultOptions & VaultKeys): Promise<Vault>; |
Not a concrete suggestion, but I think we can do something with the types to make the flow of sdk calls more intuitive.
should we also have a generateVault that is a convenience wrapper around all 3 calls?
|
|
||
| export class Vault implements IVault { | ||
| private readonly bitgo: BitGoBase; | ||
| private readonly baseCoin: IBaseCoin; |
There was a problem hiding this comment.
Hm a vault is multicoin, so not sure what we would do with this singular coin class?
1971257 to
83dcf33
Compare
Net-new sdk-core/src/bitgo/vault module mirroring the EnterpriseData/ Enterprise and WalletData/Wallet conventions: iVault/iVaults interfaces (per API Changes v1 §3), the Vault and Vaults classes, and the barrel. Vault implements getters, url(), toJSON(), and freeze/archive REST plumbing; createWallet, member, and share methods are stubbed for WCN-1203/WCN-1204. Vaults lifecycle methods (createVault, initialize, finalize, list, get) are stubbed pending Phase 2/3 (WCN-1175/1177). Wires an Enterprise.vaults() accessor and the bitgo barrel export. WCN-1192 TICKET: WCN-1192
83dcf33 to
4a87ebf
Compare
| * - eddsaMpc ③ — ex. SOL/SUI/NEAR/TON/APT/DOT | ||
| * - ed25519Multisig ④ — ex. ALGO/XLM/HBAR | ||
| */ | ||
| export const RootKeyType = t.keyof( |
There was a problem hiding this comment.
Once we finalize, we should consider moving these codecs to public-types. Having it in the sdk for now is fine though.
| id: t.string, | ||
| enterpriseId: t.string, | ||
| label: t.string, | ||
| // freeze is NOT a status — a frozen vault stays 'active' with the freeze field set (wallet precedent) |
There was a problem hiding this comment.
| // freeze is NOT a status — a frozen vault stays 'active' with the freeze field set (wallet precedent) |
| /** POST /enterprise/:eId/vaults/:vId/finalize — the 12 key ids as 4 ordered triplets. */ | ||
| export const FinalizeVaultBody = t.type({ rootKeys: VaultRootKeys }, 'FinalizeVaultBody'); | ||
|
|
||
| /** POST/DELETE /enterprise/:eId/vaults/:vId/freeze */ |
There was a problem hiding this comment.
| /** POST/DELETE /enterprise/:eId/vaults/:vId/freeze */ | |
| /** POST /enterprise/:eId/vaults/:vId/freeze */ |
| status(): VaultData['status']; | ||
| url(extra?: string): string; | ||
| createWallet(params: CreateVaultWalletOptions): Promise<Wallet>; | ||
| // whole-vault: view/admin/spend; spend opens a key share (also how a spender services a |
There was a problem hiding this comment.
| // whole-vault: view/admin/spend; spend opens a key share (also how a spender services a | |
| // whole-vault: view/admin/spend/dapp; spend opens a key share (also how a spender services a |
1ac89a2
into
WCN-1192.extend-abstract-utxo-timeout
Net-new sdk-core/src/bitgo/vault module mirroring the EnterpriseData/ Enterprise and WalletData/Wallet conventions: iVault/iVaults interfaces (per API Changes v1 §3), the Vault and Vaults classes, and the barrel. Vault implements getters, url(), toJSON(), and freeze/archive REST plumbing; createWallet, member, and share methods are stubbed for WCN-1203/WCN-1204. Vaults lifecycle methods (createVault, initialize, finalize, list, get) are stubbed pending Phase 2/3 (WCN-1175/1177). Wires an Enterprise.vaults() accessor and the bitgo barrel export.
WCN-1192
TICKET: WCN-1192